<?
if($_GET) {
	$directory = str_replace('ajax','',dirname(__FILE__));
	require_once($directory . "functions.php");
	extract($_GET);
	if($action == 'comments_table') {
		if(!$status) {
			$status = 'all';
		}
		if($time == 'today') {
			$time_start = mktime(0, 00, 00, date('m'), date('d'), date('Y'));
			$time_end = mktime(23, 59, 59, date('m'), date('d'), date('Y'));
		} elseif($time == 'past_week') {
			$time_start = mktime(0, 00, 00, date('m'), date('d') - 6, date('Y'));
			$time_end = mktime(23, 59, 59, date('m'), date('d'), date('Y'));
		} elseif($time == 'past_2_weeks') {
			$time_start = mktime(0, 00, 00, date('m'), date('d') - 13, date('Y'));
			$time_end = mktime(23, 59, 59, date('m'), date('d'), date('Y'));
		} elseif($time == 'this_month') {
			$time_start = mktime(0, 00, 00, date('m'), 1, date('Y'));
			$time_end = mktime(23, 59, 59, date('m') + 1, 0, date('Y'));
		} elseif($time == 'past_3_months') {
			$time_start = mktime(0, 00, 00, date('m') - 2, date('d'), date('Y'));
			$time_end = mktime(23, 59, 59, date('m'), date('d'), date('Y'));
		} elseif($time == 'past_6_months') {
			$time_start = mktime(0, 00, 00, date('m') - 5, date('d'), date('Y'));
			$time_end = mktime(23, 59, 59, date('m'), date('d'), date('Y'));
		} elseif($time == 'past_12_months') {
			$time_start = mktime(0, 00, 00, date('m'), date('d'), date('Y') - 1);
			$time_end = mktime(23, 59, 59, date('m'), date('d'), date('Y'));
		} elseif($time == 'this_year') {
			$time_start = mktime(0, 00, 00, 1, 1, date('Y'));
			$time_end = mktime(23, 59, 59, 1, 0, date('Y') + 1);
		} else {
			$time_start = 0;
			$time_end = time();
		}
		if($time == 'all') {
			echo "<h2>All Comments</h2>";
		} else {
			echo "<h2>" . ucwords(str_replace('_',' ',$time)) . "'s Comments</h2>";
		}
		echo $time_end;
		echo drizzo_comment_table($status, $time_start, $time_end, $limit, $offest, $sort);
	}
}
?>